<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="<%=path %>/static/css/css.css?1" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/jquery-ui/jquery-ui.min.css" />
<script type="text/javascript" src="<%=path %>/static/js/json2.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/static/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=path %>/static/layer/layer.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/gridview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/formview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/tool.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/validate.js"></script>
<script type="text/javascript" src="<%=path %>/wechat/js/copy/ZeroClipboard.js"></script>
<SCRIPT type="text/javascript">
    <!--
	var gridSetting = {
			id:'taxAdvGrid',
			po:"QhAdv",
			title:'广告列表',
			height:'auto',
			service:"uiServices!listSimple",
			tbId:"advTb",
			pageInfo: {
				records: 12,//auto表示根据容器高度自动判断
				orderby : "id desc"
			},
			oper:{
                isDisplay:true,
            	operName:"编辑",
            	url:"",
            	cssClass:"Operation",
            	width:60
            },
			fields:[
			   {	name:'id',
					hide:true
			   }
			   ,{
                  name:'type',
                  descs:"类别",
                  align:'center',
                  thstyle:"width:80px"
               }
			   ,{
                   name:'picUrl',
                   descs:"图片",
                   align:'center',
                   type:'img',
                   thstyle:"width:50px"
               },{
				   name: 'linkUrl',
				   descs:"链接地址",
				   align:'left'
			   }
               ,{
                   name: 'createDateTime',
                   descs:"创建时间",
                   align:'center',
                   thstyle:"width:150px",
                   type:'date'
               }
			]
		};
	var grid;
    $(document).ready(function(){
    	grid = new GridView("list",gridSetting,"list");
		grid.init();
		var data = [];
		grid.load({data:data});

		ajustHeight();

		$("#addBtn").click(function(){
        	location.href="/qh/public/common/r2.htmls?page=adv/adv_edit";
        });

        $("#delBtn").click(function(){
        	grid.deletes("deleteMappedRoleNavis",function(ret){
                if(ret==-1){
                    layer.msg("删除失败，请重试！");
                }else{
                    layer.msg("删除" + ret.recordNum + "条记录！",function(ret){
                        grid.reload();
                    });
                }
            });
        });

    });

    function afterLoad_advTb(){
       $(".rcon2 .mtable tbody tr").each(function(){
          var id=$(this).attr("recordid");
          var html="<a href=<%=path %>/public/common/r2.htmls?page=adv/adv_edit&id="+id+" >编辑</a>";
          $(this).find(".Operation").html(html);

          var isClose=$(this).find("td[name=isClose]").text();
          if(isClose==1){
             $(this).find("td[name=isClose]").text("是");
          }
          else{
             $(this).find("td[name=isClose]").text("否");
          }

          var copyurl="http://"+window.location.host+"/dggs/wechat/index.jsp?id="+id;
          $(this).find("td[name=copyUrl]").text(copyurl);

       });
    }
    function copyurl(id){
       // 定义一个新的复制对象
       var clip = new ZeroClipboard(
       document.getElementById("d_clip_button"+id),
       {
          moviePath: "<%=path %>/wechat/js/copy/ZeroClipboard.swf"
       }
       );

       // 复制内容到剪贴板成功后的操作
       clip.on('complete', function (client, args) {
          layer.msg("复制成功，地址为：" + args.text);
       });
    }
    //-->
</SCRIPT>
</head>

<body>
<ul class=tab_nav>
  <li>
    <a class="current" href="javascript:void(0)">广告列表</a>
  </li>
</ul>
<div class="contrainer">
<div class="rcon2" >
   <table class="search_tb">
      <tr>
         <td>
            <select name="type" style="float:left">
               <option value="">==请选择==</option>
               <option value="首页">首页</option>
               <option value="邀请赚钱">邀请赚钱</option>
               <option value="任务大厅">任务大厅</option>
               <option value="活动公告">活动公告</option>
            </select>
            <input type="button" class="searchbtn" value="" id="queryBtn">
         </td>
         <td>
            <input type="button" class="btnblue" value="新增" id="addBtn" >
            <input type="button" class="btnblue" value="删除" id="delBtn"" >
         </td>
      </tr>
   </table>
</div>
<div id="formview" class="rbox1"></div>
<div id="list" class="rbox2"></div>
</div>
<script type="text/javascript" src="<%=path %>/static/js/underscore.js"></script>
<script type='text/javascript' src='<%=path %>/static/My97DatePicker/WdatePicker.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/interface/BaseDwr.js'></script>
<script>
   $(function(){
      $("#queryBtn").click(function(){
         var type = $(".search_tb").find("select[name=type]").val();

         var data = [];
         if(type!==""){
            data.push({r:"=",name:'type',value:type});
         }
         grid.load({data:data});
         ajustHeight();
      });
   });
</script>
</body>
</html>